What is @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression?
The @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression package is designed to address a specific bug in Safari related to the collision of variable names in destructuring assignments within function expressions. This plugin works as part of the Babel toolchain to transform affected code into a format that avoids the bug, ensuring compatibility and preventing runtime errors in Safari.
Bug Fix for Safari Destructuring Collision
This code sample demonstrates a scenario where the plugin would transform the function expression to avoid a naming collision that Safari cannot handle. Without the plugin, this code might cause a runtime error in Safari due to the destructuring assignment.
const example = ({ a }) => { const { a: b } = someObject; return a + b; };